From among methods for recognizing a target object from an image, there is a method called template matching. Basic processing of template matching is to prepare, in advance, a template of an object that is a recognition target, and evaluate the degree of matching of image feature between an input image and the template so as to recognize the position and orientation of the object in the image. Object recognition using template matching is practically used in various fields such as inspection and picking in FA (Factory Automation), robot vision, and surveillance cameras.
Conventionally, in template matching in which a recognition target is a three-dimensional object, flat surfaces of the object and normal line information thereof are used as feature amounts in order to reduce a calculation amount and calculation time while maintaining an accurate recognition result (e.g., JP 2015-079374A).
In addition, when edge information is used as a feature amount in template matching, it is known that a reduction in the data amount and an increase in processing speed are realized by using a feature amount acquired by converting the value of an edge angle that is 0 to 360 degrees into 8-bit data that is set in units of 45 degrees (which is acquired by dividing 360 degrees by eight) (for example, JP 5271031).
As shown in FIGS. 7A and 7B, conventionally, when normal line information is used as a feature amount, an angle θ between the x axis and a vector acquired by mapping a normal vector onto an xy two-dimensional space is quantized so as to acquire the feature amount of a normal vector. For example, in the example in FIGS. 7A and 7B, feature amounts have been acquired by mapping normal vectors in a unit sphere shown in FIG. 7A, onto a two-dimensional space shown in FIG. 7B including reference regions 1 to 8 corresponding to eight segments acquired by equally dividing, by eight, an XY plane that passes through the center of the unit sphere, and quantizing the mapped normal vectors. For example, a normal vector 1b in FIG. 7B corresponds to a normal vector 1a in FIG. 7A, and similarly, a normal vector 2b corresponds to a normal vector 2a. The magnitude of the normal vector 1b corresponds to sin Φ of the normal vector 1a. 
Here, boundaries between the reference regions 1 to 8 concentrate in the vicinity of the z axis. Therefore, if, from among normal vectors extracted from an image in which a recognition target object is captured, the normal vector 1a that forms a small angle Φ with the camera optical axis (the z axis) of the camera that acquired the image is recognized to be different from the normal vector that is naturally recognized as that of the recognition target object due to being slightly influenced by noise, a measurement error, or the like, the vector is likely to be mapped to a different reference region in the xy two-dimensional space, and as a result, a resulting feature amount after quantization is also likely to be different. Therefore, in the case where an axis that passes through a viewpoint when registering a template matches the optical axis of the camera that acquired the input image in which the recognition target object is captured, the feature amounts of the template and the input image in which the recognition target object is captured do not match at a feature point that has a normal vector that forms a small angle Φ with the camera optical axis, which leads to a deterioration in recognition accuracy.
In view of this, one or more aspects may provide a template creation apparatus, an object recognition processing apparatus, a template creation method, and a program that can improve the recognition accuracy by using a template that is unlikely to be affected by a change in the vector direction of a normal vector that forms a small angle with the camera optical axis.